<?php $this->_extends('_layouts/main_layout'); ?>
<?php $this->_block('title'); ?>
	Setup Campaigns
<?php $this->_endblock(); ?>

<?php $this->_block('contents'); ?>
<div id="content" class="box">
	<h1>Setup Campaigns</h1>
		<?php if (isset($infos)) 
				{
					foreach ($infos as $info)
					{
		?>
				<p class="msg info"><?php echo $info;?></p>
		<?php		}
				}
		?>
		<fieldset>
			<legend>Setup Campaigns</legend>
		<?php if (isset($errors)) 
				{
					foreach ($errors as $error)
					{
		?>
				<p class="msg error"><?php echo $error;?></p>
		<?php		}
				}
		?>
	<form method="post" action="<?php echo url('offer/campaigns'); ?>">
		<input type="hidden" name="offer_id" value="<?php echo $offer_id; ?>" />
		<?php 
			if(null != $campaigns){
		?>
		<table>
			<tr>
				<th>Campaign Name</th>
				<th>Publisher Name</th>
				<th>Sub Name</th>
				<th></th>
			</tr>
			
		<?php
				foreach ($campaigns as $campaign):
		?>
			<tr>
					
				<td><label><?php echo $campaign['camp_name']; ?></label></td>
				<td><label><?php echo $campaign['pub_name']; ?></label></td>
				<td><label><?php echo $campaign['sub_name']; ?></label><br/></td>
				<td><input type="checkbox" value="<?php echo $campaign['id']; ?>" name="campaigns[]" 
					<?php echo (!empty($campaign_ids) && in_array($campaign['id'], $campaign_ids)) ? 'checked="checked"' : '' ;  ?> /></td>
	<?php 
				endforeach;;
			}else{
				echo '<a href="' . url('campaign/add') . '">Add new Campaigns</a><br/>';
			}
		?>	</tr>
		</table>
		<input type="submit" value="Setup"/>
	</form>
	</fieldset>
</div>
<?php $this->_endblock(); ?>